<?php
/*----------------------------------------------------------------------------------------------
Kit Applicatif PHP
Noyau générique d'applications PHP / generic kernel for PHP applications
noyau 0.4 / PHP 4
http://code.fredbird.org/wak

fonctions de l'API 


file version 2005-10-12 14:58:17
----------------------------------------------------------------------------------------------*/

function wakRunEvent($event,$parameters=NULL) {
	return $GLOBALS['wakController']->runEvent($event,$parameters);
}
function wakQueueEvent($event,$priority,$parameters=NULL,$resultTo=NULL) {
	return $GLOBALS['wakController']->queueEvent($event,$priority,$parameters,$resultTo);
}
function wakCancelEvent($event) {
	return $GLOBALS['wakController']->cancelEvent($event);
}
function wakCancelAllEvents() {
	return $GLOBALS['wakController']->cancelAllEvents();
}
function wakRedirect($url,$external=false) {
	return $GLOBALS['wakController']->redirect($url,$external);
}
//--------------------------------------------------------------------------------------- affichage
function & wakPageSetTemplate($file,$path=NULL) {
	$r=$GLOBALS['wakController']->pageSetTemplate($file,$path);
	return $r;
}
function & wakPageInsert($content,$path='/body',$id=NULL) {
	$r=$GLOBALS['wakController']->pageInsert($content,$path,$id);
	return $r;
}
function & wakPageThrow($file=NULL,$ignoreData=false) {
	$r=$GLOBALS['wakController']->pageSend($file,$ignoreData);
	return $r;
}
/*function & wakPageSetTitle($title) {
	$r=$GLOBALS['wakController']->pageSetTitle($title);
	return $r;
}*/
function & wakPageSet($content,$path='/body') {
	$r=$GLOBALS['wakController']->pageSet($content,$path);
	return $r;
}
function wakTemplateFeed($template,$data=array()) {
	return $GLOBALS['wakController']->templateFeed($template,$data);
}
//--------------------------------------------------------------------------------------- variables
function & wakInitVar($key,$value) {
	$r=$GLOBALS['wakController']->initVar($key,$value);
	return $r;
}
function & wakSetVar($key,& $value) {
	$r=$GLOBALS['wakController']->setVar($key,$value);
	return $r;
}
function & wakDestroyVar($key) {
	$r=$GLOBALS['wakController']->destroyVar($key);
	return $r;
}
function & wakGetVar($key) {
	//echo affvar($this->components['varmanager']['data'],false);
	$r=$GLOBALS['wakController']->getVar($key);
	return $r;
}
function & wakGetVarIn($key,$search='tmp_post') {
	$r=$GLOBALS['wakController']->getVarIn($key,$search);
	return $r;
}
function & wakGetVars($keys) {
	$r=$GLOBALS['wakController']->getVars($keys);
	return $r;
}
function & wakGetVarsIn($keys,$search="tmp_post") {
	$r=$GLOBALS['wakController']->getVarsIn($keys,$search);
	return $r;
}
function wakStoreVar($key,$value=NULL) {
	return $GLOBALS['wakController']->storeVar($key,$value);
}
function wakUrlGetVarsString($url='') {
	return $GLOBALS['wakController']->urlGetVarsString($url);
}
function wakPostVarsHiddenFields() {
	return $GLOBALS['wakController']->postVarsHiddenFields();
}
function wakGetAllVars() {
	return $GLOBALS['wakController']->GetAllVars();
}
function wakArrayMergeRR(&$array1, &$array2) {
	return $GLOBALS['wakController']->arrayMergeRR($array1, $array2);
}
function wakVarToXml(&$value,$key="") {
	return $GLOBALS['wakController']->varToXml($value,$key);
}
function wakVarToDeclaration($value,$key=NULL) {
	return $GLOBALS['wakController']->varToDeclaration($value,$key);
}
function wakAffVar($var,$key='',$cut=50) {
	return $GLOBALS['wakController']->affVar($var,$key,$cut);
}
//------------------------------------------------------------------------------------ abstractions
/*function wakXmlAlgorithmLoadMap($xml,$ref=NULL) {
	return $GLOBALS['wakController']->xmlAlgorithmLoadMap($xml,$ref);
}
function wakXmlAlgorithmLoad($xml,$ref=NULL,$data=array(),$maps="") {
	return $GLOBALS['wakController']->xmlAlgorithmLoad($xml,$ref,$data,$maps);
}
function wakXmlAlgorithmExecute($ref,$xpath=NULL,$data=NULL) {
	return $GLOBALS['wakController']->xmlAlgorithmExecute($ref,$xpath,$data);
}

function wakSqlInterfaceLoad($xml,$ref=NULL,$data=NULL) {
	return $GLOBALS['wakController']->sqlInterfaceLoad($xml,$ref,$data);
}
function wakSqlInterfaceRun($action,$ref=NULL,$data=NULL) {
	return $GLOBALS['wakController']->sqlInterfaceRun($action,$ref,$data);
}*/
//--------------------------------------------------------------------------------------------- SQL
function wakSqlOpen($base=NULL) {
	return $GLOBALS['wakController']->sqlOpen($base);
}
function wakSqlSetDb($base) {
	return $GLOBALS['wakController']->SqlSetDb($base);
}
function wakSqlExecute($query) {
	return $GLOBALS['wakController']->sqlExecute($query);
}
function wakSqlSecureValue($value) {
	return $GLOBALS['wakController']->sqlSecureValue($value);
}
function & wakSqlResult($query,$indexField=NULL) {
	$r=$GLOBALS['wakController']->sqlresult($query,$indexField);
	return $r;
}
function & wakSqlUniqueResult($query) {
	$r=$GLOBALS['wakController']->sqlUniqueResult($query);
	return $r;
}
function wakSqlTableStructure($tableName) {
	return $GLOBALS['wakController']->sqlTableStructure($tableName);
}
function wakSqlInsertArray($table,$data=array(),$explicitNegative=false) {
	return $GLOBALS['wakController']->sqlInsertArray($table,$data,$explicitNegative);
}
function wakSqlLastOpSummary($mode='string') {
	return $GLOBALS['wakController']->sqlLastOpSummary($mode);
}
//--------------------------------------------------------------------------- librairies et classes
// inclusions de librairie, transmissions d'instances
function wakNeedLibrary($name) {
	return $GLOBALS['wakController']->needLibrary($name);
}
// retourne une instance la classe, avec passage de zéro à cinq arguments
function & wakNeedObject($class) {
	$lib=& $GLOBALS['wakController']->needComponent('libmanager');
	$param=array_slice(func_get_args(),1);
	$obj=$lib->needObject($class,$param);
	return $obj;
}
// idem, pour les librairies du noyau
function & wakNeedCoreObject($class,$param=array()) {
	$lib=& $GLOBALS['wakController']->needComponent('libmanager');
	$r=$lib->needCoreObject($class,$param);
	return $r;
}
// renvoie la reference d'une instance unique de la classe
// instancie la classe si nécessaire, avec passage de zéro à cinq arguments
function & wakNeedUniqueObject($name, $class='') {
	$lib=& $GLOBALS['wakController']->needComponent('libmanager');
	$param=array_slice(func_get_args(),2);
	$r=$lib->needUniqueObject($name,$class,$param);
	return $r;
}
function & wakNeedSingleton($class='') {
	$lib=& $GLOBALS['wakController']->needComponent('libmanager');
	$param=array_slice(func_get_args(),1);
	$r=$lib->needUniqueObject($class,$class,$param);
	return $r;
}
function wakNeedFunction($name) {
	return $GLOBALS['wakController']->needFunction($name);
}
function wakNeedClass($name) {
	return $GLOBALS['wakController']->needClass($name);
}
//---------------------------------------------------------------------------- gestion des fichiers
function wakFileContent($file) {
	return $GLOBALS['wakController']->fileContent($file);
}
function wakFileGetMimeType($file) {
	return $GLOBALS['wakController']->FileGetMimeType($file);
}
function wakFileListPath($path, $recurse=false, $ignoreDot=true) {
	return $GLOBALS['wakController']->fileListPath($path, $recurse, $ignoreDot);
}
function wakFileInfo($file) {
	return $GLOBALS['wakController']->fileInfo($file);
}
function wakFileRegexSearchPathName($regex,$path="",$recurse=false) {
	return $GLOBALS['wakController']->fileRegexSearchPathName($regex,$path,$recurse);
}
function wakFileRegexSearchPathContent($regex,$path="",$recurse=false,$around=25) {
	return $GLOBALS['wakController']->fileRegexSearchPathContent($regex,$path,$recurse,$around);
}
function wakFileRegexSearchContent($regex,$path="",$around=25) {
	return $GLOBALS['wakController']->fileRegexSearchContent($regex,$path,$around);
}
function wakFileSafeUpload($postName,$path,$newName=NULL) {
	return $GLOBALS['wakController']->fileSafeUpload($postName,$path,$newName);
}
function wakFileVersionUpload($postName,$path) {
	return $GLOBALS['wakController']->fileVersionUpload($postName,$path);
}
//--------------------------------------------------------contrôle d'accès, utilisateurs et groupes
/*function wakAccessCheckUri($uri) {
	return $GLOBALS['wakController']->AccessCheckUri($uri);
}
// retourne l'id de l'utilisateur connecté le cas échéant
function wakAccessAuthenticateUser() {
	return $GLOBALS['wakController']->accessAuthenticateUser();
}
function wakAccessLogOut() {
	return $GLOBALS['wakController']->accesslogOut();
}

function wakUserAdd($data) {
	return $GLOBALS['wakController']->userAdd($data);
}
function wakUserGetById($id) {
	return $GLOBALS['wakController']->UserGetById($id);
}
function wakUserGetIdByLoginPwd($login,$pwd) {
	return $GLOBALS['wakController']->UserGetIdByLoginPwd($login,$pwd);
}
function wakConnexionCheck($key=NULL) {
	return $GLOBALS['wakController']->connexionCheck($key);
}
function wakConnexionOpen($userId) {
	return $GLOBALS['wakController']->connexionOpen($userId);
}
function wakConnexionClose($key) {
	return $GLOBALS['wakController']->connexionClose($key);
}
function wakUriPermissionIsPublic($uri=NULL) {
	return $GLOBALS['wakController']->uriPermissionIsPublic($uri);
}
function wakUriPermissionCheckId($id,$uri=NULL) {
	return $GLOBALS['wakController']->uriPermissionCheckId($id,$uri);
}
function wakUriPermissionCheckIds($ids=array(),$uri=NULL) {
	return $GLOBALS['wakController']->uriPermissionCheckIds($ids,$uri);
}
function wakGroupGetUserGroupIds($user_id) {
	return $GLOBALS['wakController']->groupGetUserGroupIds($user_id);
}*/
//-------------------------------------------------------------------------------------- navigation
/*function wakNavLoadArbo($file, $prefixUri=NULL) {
	return $GLOBALS['wakController']->navLoadArbo($file, $prefixUri);
}
function wakNavPathFromRoot($uri=NULL) {
	return $GLOBALS['wakController']->navPathFromRoot($uri);
}
function wakNavTopLevel() {
	return $GLOBALS['wakController']->navTopLevel();
}
function wakNavSameLevel($uri=NULL) {
	return $GLOBALS['wakController']->navSameLevel($uri);
}
function wakNavChildren($uri=NULL) {
	return $GLOBALS['wakController']->navChildren($uri);
}
function wakNavTree() {
	return $GLOBALS['wakController']->navTree();
}*/
//-------------------------------------------------------------------- autour des dates et du temps
function wakDateConvert($output_format,$date=NULL,$input_format=NULL) {
	return $GLOBALS['wakController']->dateConvert($output_format,$date,$input_format);
}
function wakDateFr($format,$date=NULL,$input_format=NULL) {
	return $GLOBALS['wakController']->dateFr($format,$date,$input_format);
}
function wakDateWeek($date=NULL) {
	return $GLOBALS['wakController']->dateWeek($date);
}
function wakDateYear($date=NULL) {
	return $GLOBALS['wakController']->dateYear($date);
}
function wakDateSelectForm($prefix="",$date=NULL,$elements="mday_mon_year",$label=NULL) {
	return $GLOBALS['wakController']->dateSelectForm($prefix,$date,$elements,$label);
}
function wakDateCatchForm($prefix="",$output_format="php_getdate") {
	return $GLOBALS['wakController']->dateCatchForm($prefix,$output_format);
}
function wakDateAdd($date1,$date2,$outputFormat=NULL) {
	return $GLOBALS['wakController']->dateAdd($date1,$date2,$outputFormat);
}
function wakDateSoustract($date1,$date2,$outputFormat=NULL) {
	return $GLOBALS['wakController']->dateSoustract($date1,$date2,$outputFormat);
}
function wakTimeTaken() {
	return $GLOBALS['wakController']->timeTaken();
}
//----------------------------------------------------------------------- autour du texte et du xml
function wakXmlEntities(& $str) {
	return $GLOBALS['wakController']->xmlEntities($str);
}
function wakXmlEntitiesDecode(& $str) {
	return $GLOBALS['wakController']->xmlEntitiesDecode($str);
}
//----------------------------------------------------------------------------- gestion des erreurs
/*function wakNotice($txt) {
	return $GLOBALS['wakController']->notice($txt);
}
function wakWarning($txt) {
	return $GLOBALS['wakController']->warning($txt);
}
function wakError($txt) {
	return $GLOBALS['wakController']->error($txt);
}*/
function wakLog($msg) {
	return $GLOBALS['wakController']->Log($msg);
}
//------------------------------------------------------------------------------------------ divers
function wakCheckPhpVersion($minimum="4.3.0") {
	return $GLOBALS['wakController']->CheckPhpVersion($minimum="4.3.0");
}
function wakCheckExtension($extension) {
	return $GLOBALS['wakController']->checkExtension($extension);
}
function wakShutDown($showlog=NULL) {
	return $GLOBALS['wakController']->shutdown($showlog);
}
function wakAlert($txt) {
	return $GLOBALS['wakController']->alert($txt);
}
function wakErrorLevel($level='none') {
	return $GLOBALS['wakController']->errorLevel($level);
}
?>
